package com.xiaodu.validator.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;

/**
 * @author: dutianjie
 * @date: 2021/3/31
 * @version: v1.0.0
 * @description: 描述
 **/
@ApiModel(description = "商品详情")
public class Product {

    @ApiModelProperty(required = true, value = "商品名称")
    @NotBlank
    @Length(min = 1, max = 500)
    private String name;

    @ApiModelProperty(required = true, value = "商品id")
    @NotBlank
    @Length(max = 32, min = 32)
    private String id;

    @ApiModelProperty(required = true, value = "商品价格,以分为单位", dataType = "java.lang.Long", example = "1000")
    @Max(Integer.MAX_VALUE)
    @Min(0)
    private Long price;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Long getPrice() {
        return price;
    }

    public void setPrice(Long price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return "Product{" +
                "name='" + name + '\'' +
                ", id='" + id + '\'' +
                ", price=" + price +
                '}';
    }
}
